home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / DisciplineMesmerize.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  2.1 KB  |  49 lines

  1. public class DisciplineMesmerize extends Discipline {
  2.    private static final String DISCIPLINE_NAME = "Mesmerize";
  3.  
  4.    public int cast(int level, int casterGuid, int targetGuid) {
  5.       if (!((Discipline)this).CheckCastParameters(level, casterGuid, "Mesmerize")) {
  6.          return 0;
  7.       } else if (!((Discipline)this).CheckCastTarget(targetGuid, "Mesmerize")) {
  8.          return 0;
  9.       } else {
  10.          ((Discipline)this).SetupWorld("Mesmerize");
  11.          if (((Discipline)this).Fizzled(level)) {
  12.             ((Discipline)this).DisplayFizzle("Mesmerize", level);
  13.             return 0;
  14.          } else {
  15.             try {
  16.                ((Discipline)this).DisplayCast("Mesmerize", level);
  17.                float clanFactor = 1.0F;
  18.                if (super.targetThing.GetActorClanId() == 12) {
  19.                   clanFactor = 0.5F;
  20.                }
  21.  
  22.                if (super.targetThing.GetActorClanId() == 9) {
  23.                   clanFactor = 0.5F;
  24.                }
  25.  
  26.                if ((super.targetThing.AIGetMindFlags() & 4) == 0 && super.targetThing.GetActorStat(9) >= super.casterThing.GetActorStat(9) && Math.random() * (double)super.targetThing.GetActorStat(5) * (double)clanFactor < Math.random() * (double)super.casterThing.GetActorStat(12)) {
  27.                   int effectGuid = super.targetThing.FindActorEffect("ef_disc_mesmerize");
  28.                   if (effectGuid != 0) {
  29.                      super.targetThing.RemoveActorEffect(effectGuid);
  30.                   }
  31.  
  32.                   super.targetThing.AddActorEffectByLevel("ef_disc_mesmerize", Discipline.MESMERIZE_DURATIONS[level], level, casterGuid, 4);
  33.                } else {
  34.                   ((Discipline)this).DisplayResist("Mesmerize", level);
  35.                }
  36.  
  37.                return 1;
  38.             } catch (Exception var7) {
  39.                CodexConsole.PrintException(((Throwable)var7).getMessage() + " in " + "Mesmerize" + " [cast]");
  40.                return 0;
  41.             } catch (Error var8) {
  42.                CodexConsole.PrintError(((Throwable)var8).getMessage() + " in " + "Mesmerize" + " [cast]");
  43.                return 0;
  44.             }
  45.          }
  46.       }
  47.    }
  48. }
  49.